<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/7/007
 * Time: 11:23
 */

namespace app\Lib\Model\Order;


use app\Lib\Model\DbModel\OrderImg;
use app\Lib\Model\DbModel\OrderPanoramicUrl;
use app\Lib\Model\Img\Img;

class GetPicFile
{
    private $order;
    public function __construct(Order $order)
    {
        $this->order = $order;
    }


    public function run(){
        $table = new OrderImg();
        $table_1 = new OrderPanoramicUrl();
        $imgArray = $table->where([$table->_order_id=>$this->order->get_order_id()])->column($table->_img_id,$table->_id);
        $pathUrl  = $table_1->where([$table_1->_order_id=>$this->order->get_order_id()])->column($table_1->_path_url,$table_1->_id);
        $orderImg = [];
        if(!empty($imgArray)){
            foreach ($imgArray as $k=>$v){
                $orderImg[$k]['path']=(new Img($v))->getFilePath();
                $orderImg[$k]['img_id']=$v;
            }
        }
        $data = [
            'img'=>$orderImg,
            'pathUrl'=>$pathUrl,
        ];
        return $data;
    }
}